﻿using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using DG.Common.EF.WPF;
using DG.Common.Patterns.MVVM;
using TCC.ControleFluxoDeCaixa.Model.Fluxo;
using TCC.ControleFluxoDeCaixa.Model.Usuarios;

namespace TCC.ControleFluxoDeCaixa.Model.Contas
{
    public class ContaFinanceira : NotifyViewModel
    {
        [Key]
        [Browsable(false)]
        public int ContaFinanceiraId { get; set; }
        [Required]
        [Index("IX_NomeUnicoPorUsuario", 1)]
        [MaxLength(255)]
        public string Nome { get; set;}
        [Required]
        [FilteredAtributte(false)]
        public virtual Usuario Usuario { get; set; }

        [ForeignKey("Usuario")]
        [Index("IX_NomeUnicoPorUsuario", 0)]
        public int UsuarioId { get; set; }

        [FilteredAtributte(false)]
        public virtual HashSet<Movimento> Movimentos { get; set; }

        [Display(Name = "Ativa ?")]
        public bool IsAtiva { get; set; }

        public override string ToString()
        {
            return Nome;
        }

        public ContaFinanceira()
        {
            IsAtiva = true;
        }
    }
}
